import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/layout/Index.vue'

const routes = [
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: 'mall',
        name: 'Mall',
        meta: { title: '商城模块', icon: 'shopping-cart' },
        children: [
          { path: 'home', name: '商城首页', component: () => import('@/views/mall/Home.vue') },
          { path: 'product', name: '商品详情', component: () => import('@/views/mall/Product.vue') },
          { path: 'account', name: '我的账户', component: () => import('@/views/mall/Account.vue') },
          { path: 'cart', name: '购物车', component: () => import('@/views/mall/Cart.vue') }
        ]
      },
      {
        path: 'agri-edu',
        name: 'AgriEdu',
        meta: { title: '农教模块', icon: 'help' },
        children: [
          { path: 'expert', name: '专家库', component: () => import('@/views/agri-edu/Expert.vue') },
          { path: 'science', name: '科普信息', component: () => import('@/views/agri-edu/Science.vue') },
          { path: 'ai', name: 'AI助手', component: () => import('@/views/agri-edu/AI.vue') }
        ]
      },
      {
        path: 'community',
        name: 'Community',
        meta: { title: '社区模块', icon: 'message' },
        children: [
          { path: 'topics', name: '话题', component: () => import('@/views/community/Topics.vue') },
          { path: 'interaction', name: '互动评价', component: () => import('@/views/community/Interaction.vue') },
          { path: 'user', name: '用户主页', component: () => import('@/views/community/User.vue') }
        ]
      }
    ]
  }
]

export default createRouter({
  history: createWebHistory(),
  routes
})